/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package grundlagen.Ausnahmen;

/**
 *
 * @author dgreipl
 */
public class Fehlerbeispiel {

    public static double teile(int x, int y) {
        return x / y;
    }

    public static double dividiere(int x, int y) throws Exception {
        return x / y;
    }

    public static double wurzel(double x) throws Exception {
        if (x >= 0) {
            return Math.sqrt(x);
        } else {
            throw new Exception("Negativer Wert in der Wurzel!");
        }
    }
}
